package 创建型设计模式.工厂模式.抽象工厂模式.demo;

/**
 * @Author lf
 * @Date 3/26/2024
 */
public class AbstractFactoryDemo {
    public static void main(String[] args) {
        VehicleFactory electricFactory = new ElectricVehicleFactory();
        Car electricCar = electricFactory.createCar();
        Bike electricBike = electricFactory.createBike();
        electricCar.create();  // 输出：Create an electric car
        electricBike.create();  // 输出：Create an electric bike

        VehicleFactory fuelFactory = new FuelVehicleFactory();
        Car fuelCar = fuelFactory.createCar();
        Bike fuelBike = fuelFactory.createBike();
        fuelCar.create();  // 输出：Create a fuel car
        fuelBike.create();  // 输出：Create a fuel bike
    }
}
